try {
const specRes = await speciesApi.getSpecies();
this.setState({ species: specRes.data });
resolve();
} catch (err) {
reject();
return;
}
resolve();
})
render() {
if (this.props.error) {
return (<ErrorPage message={this.props.errorMessage} />);
}
return (
<div
style={{
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
}}
>
<Notifications ref={this.notificationsRef} />
<div className={this.props.classes.table}>
<MaterialTable
options={{
pageSize: 25,
pageSizeOptions: [25, 100, 800],
exportButton: true,
emptyRowsWhenPaging: false,
addRowPosition: 'first',
}}
columns={[
{ title: 'Species', field: 'species' },
{ title: 'Scientific Name', field: 'scientificName' },
{
title: 'Category',
field: 'category',
},
{ title: 'Type', field: 'type' },
]}
editable={{
onRowAdd: this.onRowAdd,
onRowUpdate: this.onRowUpdate,
onRowDelete: this.onRowDelete,
}}
data={this.state.species}
title="Species List"
/>
</div>
</div>
);
}
}
export default Home;